home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / man.n / menu.n < prev    next >
Text File  |  1995-07-21  |  24KB  |  692 lines

  1. '\"
  2. '\" Copyright (c) 1990-1992 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/wish/man/RCS/menu.n,v 1.17 93/10/23 16:50:39 ouster Exp $ SPRITE (Berkeley)
  22. '/" 
  23. .\" The definitions below are for supplemental macros used in Tcl/Tk
  24. .\" manual entries.
  25. .\"
  26. .\" .HS name section [date [version]]
  27. .\"    Replacement for .TH in other man pages.  See below for valid
  28. .\"    section names.
  29. .\"
  30. .\" .AP type name in/out [indent]
  31. .\"    Start paragraph describing an argument to a library procedure.
  32. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  33. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  34. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  35. .\"    needed;  use .AS below instead)
  36. .\"
  37. .\" .AS [type [name]]
  38. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  39. .\"    name are examples of largest possible arguments that will be passed
  40. .\"    to .AP later.  If args are omitted, default tab stops are used.
  41. .\"
  42. .\" .BS
  43. .\"    Start box enclosure.  From here until next .BE, everything will be
  44. .\"    enclosed in one large box.
  45. .\"
  46. .\" .BE
  47. .\"    End of box enclosure.
  48. .\"
  49. .\" .VS
  50. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  51. .\"    of man pages.
  52. .\"
  53. .\" .VE
  54. .\"    End of vertical sidebar.
  55. .\"
  56. .\" .DS
  57. .\"    Begin an indented unfilled display.
  58. .\"
  59. .\" .DE
  60. .\"    End of indented unfilled display.
  61. .\"
  62. '\"    # Heading for Tcl/Tk man pages
  63. .de HS
  64. .ds ^3 \\0
  65. .if !"\\$3"" .ds ^3 \\$3
  66. .if '\\$2'cmds'       .TH \\$1 1 \\*(^3 \\$4
  67. .if '\\$2'lib'        .TH \\$1 3 \\*(^3 \\$4
  68. .if '\\$2'tcl'        .TH \\$1 n \\*(^3 Tcl "Tcl Built-In Commands"
  69. .if '\\$2'tk'         .TH \\$1 n \\*(^3 Tk "Tk Commands"
  70. .if '\\$2'tclc'        .TH \\$1 3 \\*(^3 Tcl "Tcl Library Procedures"
  71. .if '\\$2'tkc'         .TH \\$1 3 \\*(^3 Tk "Tk Library Procedures"
  72. .if '\\$2'tclcmds'         .TH \\$1 1 \\*(^3 Tk "Tcl Applications"
  73. .if '\\$2'tkcmds'         .TH \\$1 1 \\*(^3 Tk "Tk Applications"
  74. .if t .wh -1.3i ^B
  75. .nr ^l \\n(.l
  76. .ad b
  77. ..
  78. '\"    # Start an argument description
  79. .de AP
  80. .ie !"\\$4"" .TP \\$4
  81. .el \{\
  82. .   ie !"\\$2"" .TP \\n()Cu
  83. .   el          .TP 15
  84. .\}
  85. .ie !"\\$3"" \{\
  86. .ta \\n()Au \\n()Bu
  87. \&\\$1    \\fI\\$2\\fP    (\\$3)
  88. .\".b
  89. .\}
  90. .el \{\
  91. .br
  92. .ie !"\\$2"" \{\
  93. \&\\$1    \\fI\\$2\\fP
  94. .\}
  95. .el \{\
  96. \&\\fI\\$1\\fP
  97. .\}
  98. .\}
  99. ..
  100. '\"    # define tabbing values for .AP
  101. .de AS
  102. .nr )A 10n
  103. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  104. .nr )B \\n()Au+15n
  105. .\"
  106. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  107. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  108. ..
  109. '\"    # BS - start boxed text
  110. '\"    # ^y = starting y location
  111. '\"    # ^b = 1
  112. .de BS
  113. .br
  114. .mk ^y
  115. .nr ^b 1u
  116. .if n .nf
  117. .if n .ti 0
  118. .if n \l'\\n(.lu\(ul'
  119. .if n .fi
  120. ..
  121. '\"    # BE - end boxed text (draw box now)
  122. .de BE
  123. .nf
  124. .ti 0
  125. .mk ^t
  126. .ie n \l'\\n(^lu\(ul'
  127. .el \{\
  128. .\"    Draw four-sided box normally, but don't draw top of
  129. .\"    box if the box started on an earlier page.
  130. .ie !\\n(^b-1 \{\
  131. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  132. .\}
  133. .el \}\
  134. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  135. .\}
  136. .\}
  137. .fi
  138. .br
  139. .nr ^b 0
  140. ..
  141. '\"    # VS - start vertical sidebar
  142. '\"    # ^Y = starting y location
  143. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  144. .de VS
  145. .mk ^Y
  146. .ie n 'mc \s12\(br\s0
  147. .el .nr ^v 1u
  148. ..
  149. '\"    # VE - end of vertical sidebar
  150. .de VE
  151. .ie n 'mc
  152. .el \{\
  153. .ev 2
  154. .nf
  155. .ti 0
  156. .mk ^t
  157. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  158. .sp -1
  159. .fi
  160. .ev
  161. .\}
  162. .nr ^v 0
  163. ..
  164. '\"    # Special macro to handle page bottom:  finish off current
  165. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  166. '\"    # page bottom macro.
  167. .de ^B
  168. .ev 2
  169. 'ti 0
  170. 'nf
  171. .mk ^t
  172. .if \\n(^b \{\
  173. .\"    Draw three-sided box if this is the box's first page,
  174. .\"    draw two sides but no top otherwise.
  175. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  176. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  177. .\}
  178. .if \\n(^v \{\
  179. .nr ^x \\n(^tu+1v-\\n(^Yu
  180. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  181. .\}
  182. .bp
  183. 'fi
  184. .ev
  185. .if \\n(^b \{\
  186. .mk ^y
  187. .nr ^b 2
  188. .\}
  189. .if \\n(^v \{\
  190. .mk ^Y
  191. .\}
  192. ..
  193. '\"    # DS - begin display
  194. .de DS
  195. .RS
  196. .nf
  197. .sp
  198. ..
  199. '\"    # DE - end display
  200. .de DE
  201. .fi
  202. .RE
  203. .sp .5
  204. ..
  205. .HS menu tk
  206. .BS
  207. '\" Note:  do not modify the .SH NAME line immediately below!
  208. .SH NAME
  209. menu \- Create and manipulate menu widgets
  210. .SH SYNOPSIS
  211. \fBmenu\fI \fIpathName \fR?\fIoptions\fR?
  212. .SH "STANDARD OPTIONS"
  213. .LP
  214. .nf
  215. .ta 4c 8c 12c
  216. .VS
  217. \fBactiveBackground\fR    \fBbackground\fR    \fBdisabledForeground\fR
  218. \fBactiveBorderWidth\fR    \fBborderWidth\fR    \fBfont\fR
  219. \fBactiveForeground\fR    \fBcursor\fR    \fBforeground\fR
  220. .VE
  221. .fi
  222. .LP
  223. See the ``options'' manual entry for details on the standard options.
  224. .SH "WIDGET-SPECIFIC OPTIONS"
  225. .ta 4c
  226. .LP
  227. .nf
  228. Name:    \fBpostCommand\fR
  229. .VS
  230. Class:    \fBCommand\fR
  231. Command-Line Switch:    \fB\-postcommand\fR
  232. .fi
  233. .IP
  234. If this option is specified then it provides a Tcl command to execute
  235. each time the menu is posted.  The command is invoked by the \fBpost\fR
  236. widget command before posting the menu.
  237. .VE
  238. .LP
  239. .nf
  240. Name:    \fBselector\fR
  241. Class:    \fBForeground\fR
  242. Command-Line Switch:    \fB\-selector\fR
  243. .fi
  244. .IP
  245. For menu entries that are check buttons or radio buttons, this option
  246. specifies the color to display in the selector when the check button
  247. or radio button is selected.
  248. .BE
  249.  
  250. .SH INTRODUCTION
  251. .PP
  252. The \fBmenu\fR command creates a new top-level window (given
  253. by the \fIpathName\fR argument) and makes it into a menu widget.
  254. Additional
  255. options, described above, may be specified on the command line
  256. or in the option database
  257. to configure aspects of the menu such as its colors and font.
  258. The \fBmenu\fR command returns its
  259. \fIpathName\fR argument.  At the time this command is invoked,
  260. there must not exist a window named \fIpathName\fR, but
  261. \fIpathName\fR's parent must exist.
  262. .PP
  263. A menu is a widget that displays a collection of one-line entries arranged
  264. in a column.  There exist several different types of entries,
  265. each with different properties.  Entries of different types may be
  266. combined in a single menu.  Menu entries are not the same as
  267. entry widgets.  In fact, menu entries are not even distinct widgets;
  268. the entire menu is one widget.
  269. .PP
  270. Menu entries are displayed with up to three
  271. separate fields.  The main field is a label in the form of text or
  272. a bitmap, which is determined by the \fB\-label\fR or \fB\-bitmap\fR
  273. option for the entry.
  274. If the  \fB\-accelerator\fR option is specified for an entry then a second
  275. textual field is displayed to the right of the label.  The accelerator
  276. typically describes a keystroke sequence that may be typed in the
  277. application to cause the same result as invoking the menu entry.
  278. The third field is a \fIselector\fR.  The selector is present only for
  279. check-button or radio-button entries.  It indicates whether the entry
  280. is selected or not, and is displayed to the left of the entry's
  281. string.
  282. .PP
  283. In normal use, an entry becomes active (displays itself differently)
  284. whenever the mouse pointer is over the entry.  If a mouse
  285. button is released over the entry then the entry is \fIinvoked\fR.
  286. The effect of invocation is different for each type of entry;
  287. these effects are described below in the sections on individual
  288. entries.
  289. .PP
  290. Entries may be \fIdisabled\fR, which causes their labels
  291. and accelerators to be displayed
  292. with dimmer colors.  A disabled entry cannot be activated or invoked.
  293. Disabled entries may be re-enabled, at which point it becomes
  294. possible to activate and invoke them again.
  295.  
  296. .SH "COMMAND ENTRIES"
  297. .PP
  298. The most common kind of menu entry is a command entry, which
  299. behaves much like a button widget.  When a command entry is
  300. invoked, a Tcl command is executed.  The Tcl
  301. command is specified with the \fB\-command\fR option.
  302.  
  303. .SH "SEPARATOR ENTRIES"
  304. .PP
  305. A separator is an entry that is displayed as a horizontal dividing
  306. line.  A separator may not be activated or invoked, and it has
  307. no behavior other than its display appearance.
  308.  
  309. .SH "CHECK-BUTTON ENTRIES"
  310. .PP
  311. A check-button menu entry behaves much like a check-button widget.
  312. When it is invoked it toggles back and forth between the selected
  313. and deselected states.  When the entry is selected, a particular
  314. value is stored in a particular global variable (as determined by
  315. the \fB\-onvalue\fR and \fB\-variable\fR options for the entry);  when
  316. the entry is deselected another value (determined by the
  317. \fB\-offvalue\fR option) is stored in the global variable.
  318. A selector box is displayed to the left of the label in a check-button
  319. entry.  If the entry is selected then the box's center is displayed
  320. in the color given by the \fBselector\fR option for the menu;
  321. otherwise the box's center is displayed in the background color for
  322. the menu.  If a \fB\-command\fR option is specified for a check-button
  323. entry, then its value is evaluated as a Tcl command each time the entry
  324. is invoked;  this happens after toggling the entry's
  325. selected state.
  326.  
  327. .SH "RADIO-BUTTON ENTRIES"
  328. .PP
  329. A radio-button menu entry behaves much like a radio-button widget.
  330. Radio-button entries are organized in groups of which only one
  331. entry may be selected at a time.  Whenever a particular entry
  332. becomes selected it stores a particular value into a particular
  333. global variable (as determined by the \fB\-value\fR and
  334. \fB\-variable\fR options for the entry).  This action
  335. causes any previously-selected entry in the same group
  336. to deselect itself.
  337. Once an entry has become selected, any change to the entry's
  338. associated variable will cause the entry to deselect itself.
  339. Grouping of radio-button entries is determined by their
  340. associated variables:  if two entries have the same associated
  341. variable then they are in the same group.
  342. A selector diamond is displayed to the left of the label in each
  343. radio-button entry.  If the entry is selected then the diamond's
  344. center is displayed in the color given by the \fBselector\fR option
  345. for the menu;
  346. otherwise the diamond's center is displayed in the background color for
  347. the menu.  If a \fB\-command\fR option is specified for a radio-button
  348. entry, then its value is evaluated as a Tcl command each time the entry
  349. is invoked;  this happens after selecting the entry.
  350.  
  351. .SH "CASCADE ENTRIES"
  352. .PP
  353. A cascade entry is one with an associated menu (determined
  354. by the \fB\-menu\fR option).  Cascade entries allow the construction
  355. of cascading menus.  When the entry is activated, the
  356. associated menu is posted just to the right of the entry;
  357. that menu remains posted until the higher-level menu is unposted or
  358. until some other entry is activated in the higher-level menu.
  359. The associated menu should normally be a child of the menu containing
  360. the cascade entry, in order for menu traversal to work correctly.
  361. .PP
  362. A cascade entry posts its associated menu by invoking a
  363. Tcl command of the form
  364. .RS
  365. .IP
  366. \fImenu\fB post \fIx y\fR
  367. .RE
  368. .LP
  369. where \fImenu\fR is the path name of the associated menu, \fIx\fR
  370. and \fIy\fR are the root-window coordinates of the upper-right
  371. corner of the cascade entry, and \fIgroup\fR is the name of the
  372. menu's group (as determined in its last \fBpost\fR widget command).
  373. The lower-level menu is unposted by executing a Tcl command with
  374. the form
  375. .RS
  376. .IP
  377. \fImenu\fB unpost\fR
  378. .RE
  379. .LP
  380. where \fImenu\fR is the name of the associated menu.
  381. .LP
  382. If a \fB\-command\fR option is specified for a cascade entry then it is
  383. .VS
  384. evaluated as a Tcl command each time the associated menu is posted (the
  385. evaluation occurs before the menu is posted).
  386. .VE
  387.  
  388. .SH "WIDGET COMMAND"
  389. .PP
  390. The \fBmenu\fR command creates a new Tcl command whose
  391. name is \fIpathName\fR.  This
  392. command may be used to invoke various
  393. operations on the widget.  It has the following general form:
  394. .DS C
  395. \fIpathName option \fR?\fIarg arg ...\fR?
  396. .DE
  397. \fIOption\fR and the \fIarg\fRs
  398. determine the exact behavior of the command.
  399. .PP
  400. Many of the widget commands for a menu take as one argument an
  401. indicator of which entry of the menu to operate on.  These
  402. indicators are called \fIindex\fRes and may be specified in
  403. any of the following forms:
  404. .TP 12
  405. \fInumber\fR
  406. Specifies the entry numerically, where 0 corresponds
  407. to the top-most entry of the menu, 1 to the entry below it, and
  408. so on.
  409. .TP 12
  410. \fBactive\fR
  411. Indicates the entry that is currently active.  If no entry is
  412. active then this form is equivalent to \fBnone\fR.  This form may
  413. not be abbreviated.
  414. .TP 12
  415. \fBlast\fR
  416. Indicates the bottommost entry in the menu.  If there are no
  417. entries in the menu then this form is equivalent to \fBnone\fR.
  418. This form may not be abbreviated.
  419. .TP 12
  420. \fBnone\fR
  421. Indicates ``no entry at all'';  this is used most commonly with
  422. the \fBactivate\fR option to deactivate all the entries in the
  423. menu.  In most cases the specification of \fBnone\fR causes
  424. nothing to happen in the widget command.
  425. This form may not be abbreviated.
  426. .TP 12
  427. \fB@\fInumber\fR
  428. In this form, \fInumber\fR is treated as a y-coordinate in the
  429. menu's window;  the entry spanning that y-coordinate is used.
  430. For example, ``\fB@0\fR'' indicates the top-most entry in the
  431. window.  If \fInumber\fR is outside the range of the window
  432. then this form is equivalent to \fBnone\fR.
  433. .TP 12
  434. \fIpattern\fR
  435. If the index doesn't satisfy one of the above forms then this
  436. form is used.  \fIPattern\fR is pattern-matched against the label of
  437. each entry in the menu, in order from the top down, until a
  438. matching entry is found.  The rules of \fBTcl_StringMatch\fR
  439. are used.
  440. .PP
  441. The following widget commands are possible for menu widgets:
  442. .TP
  443. \fIpathName \fBactivate \fIindex\fR
  444. Change the state of the entry indicated by \fIindex\fR to \fBactive\fR
  445. and redisplay it using its active colors.
  446. Any previously-active entry is deactivated.  If \fIindex\fR
  447. is specified as \fBnone\fR, or if the specified entry is
  448. disabled, then the menu ends up with no active entry.
  449. Returns an empty string.
  450. .TP
  451. \fIpathName \fBadd \fItype \fR?\fIoption value option value ...\fR?
  452. Add a new entry to the bottom of the menu.  The new entry's type
  453. is given by \fItype\fR and must be one of \fBcascade\fR,
  454. \fBcheckbutton\fR, \fBcommand\fR, \fBradiobutton\fR, or \fBseparator\fR,
  455. or a unique abbreviation of one of the above.  If additional arguments
  456. are present, they specify any of the following options:
  457. .RS
  458. .TP
  459. \fB\-activebackground \fIvalue\fR
  460. .VS
  461. Specifies a background color to use for displaying this entry when it
  462. is active.
  463. If this option is specified as an empty string (the default), then the
  464. \fBactiveBackground\fR option for the overall menu is used.
  465. This option is not available for separator entries.
  466. .VE
  467. .TP
  468. \fB\-accelerator \fIvalue\fR
  469. Specifies a string to display at the right side of the menu entry.
  470. Normally describes an accelerator keystroke sequence that may be
  471. typed to invoke the same function as the menu entry.  This option
  472. is not available for separator entries.
  473. .TP
  474. \fB\-background \fIvalue\fR
  475. .VS
  476. Specifies a background color to use for displaying this entry when it
  477. is in the normal state (neither active nor disabled).
  478. If this option is specified as an empty string (the default), then the
  479. \fBbackground\fR option for the overall menu is used.
  480. This option is not available for separator entries.
  481. .VE
  482. .TP
  483. \fB\-bitmap \fIvalue\fR
  484. Specifies a bitmap to display in the menu instead of a textual
  485. label, in any of the forms accepted by \fBTk_GetBitmap\fR.
  486. This option overrides the \fB\-label\fR option but may be reset
  487. to an empty string to enable a textual label to be displayed.
  488. This option is not available for separator entries.
  489. .TP
  490. \fB\-command \fIvalue\fR
  491. For command, checkbutton, and radiobutton entries, specifies a
  492. .VS
  493. Tcl command to execute when the menu entry is invoked.
  494. For cascade entries, specifies a Tcl command to execute
  495. when the entry is activated (i.e. just before its submenu is
  496. posted).
  497. .VE
  498. Not available for separator entries.
  499. .TP
  500. \fB\-font \fIvalue\fR
  501. .VS
  502. Specifies the font to use when drawing the label or accelerator
  503. string in this entry.
  504. If this option is specified as an empty string (the default) then
  505. the \fBfont\fR option for the overall menu is used.
  506. This option is not available for separator entries.
  507. .VE
  508. .TP
  509. \fB\-label \fIvalue\fR
  510. Specifies a string to display as an identifying label in the menu
  511. entry.  Not available for separator entries.
  512. .TP
  513. \fB\-menu \fIvalue\fR
  514. Available only for cascade entries.  Specifies the path name of
  515. the menu associated with this entry.
  516. .TP
  517. \fB\-offvalue \fIvalue\fR
  518. Available only for check-button entries.  Specifies the value to
  519. store in the entry's associated variable when the entry is
  520. deselected.
  521. .TP
  522. \fB\-onvalue \fIvalue\fR
  523. Available only for check-button entries.  Specifies the value to
  524. store in the entry's associated variable when the entry is selected.
  525. .TP
  526. \fB\-state \fIvalue\fR
  527. .VS
  528. Specifies one of three states for the entry:  \fBnormal\fR, \fBactive\fR,
  529. or \fBdisabled\fR.  In normal state the entry is displayed using the
  530. \fBforeground\fR option for the menu and the \fBbackground\fR
  531. option from the entry or the menu.
  532. The active state is typically used when the pointer is over the entry.
  533. In active state the entry is displayed using the \fBactiveForeground\fR
  534. option for the menu along with the \fBactivebackground\fR option from
  535. the entry.
  536. Disabled state means that the entry is insensitive:  it doesn't activate
  537. and doesn't respond to mouse button presses or releases.
  538. In this state the entry is displayed according to the 
  539. \fBdisabledForeground\fR option for the menu and the
  540. \fBbackground\fR option from the entry.
  541. This option is not available for separator entries.
  542. .TP
  543. \fB\-underline \fIvalue\fR
  544. Specifies the integer index of a character to underline in the entry.
  545. This option is typically used to indicate keyboard traversal characters.
  546. 0 corresponds to the first character of the text displayed in the entry,
  547. 1 to the next character, and so on.
  548. If a bitmap is displayed in the entry then this option is ignored.
  549. This option is not available for separator entries.
  550. .VE
  551. .TP
  552. \fB\-value \fIvalue\fR
  553. Available only for radio-button entries.  Specifies the value to
  554. store in the entry's associated variable when the entry is selected.
  555. .TP
  556. \fB\-variable \fIvalue\fR
  557. Available only for check-button and radio-button entries.  Specifies
  558. the name of a global value to set when the entry is selected.
  559. For check-button entries the variable is also set when the entry
  560. is deselected.  For radio-button entries, changing the variable
  561. causes the currently-selected entry to deselect itself.
  562. .LP
  563. The \fBadd\fR widget command returns an empty string.
  564. .RE
  565. .TP
  566. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  567. Query or modify the configuration options of the widget.
  568. If no \fIoption\fR is specified, returns a list describing all of
  569. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  570. information on the format of this list).  If \fIoption\fR is specified
  571. with no \fIvalue\fR, then the command returns a list describing the
  572. one named option (this list will be identical to the corresponding
  573. sublist of the value returned if no \fIoption\fR is specified).  If
  574. one or more \fIoption\-value\fR pairs are specified, then the command
  575. modifies the given widget option(s) to have the given value(s);  in
  576. this case the command returns an empty string.
  577. \fIOption\fR may have any of the values accepted by the \fBmenu\fR
  578. command.
  579. .TP
  580. \fIpathName \fBdelete \fIindex1\fR ?\fIindex2\fR?
  581. Delete all of the menu entries between \fIindex1\fR and
  582. .VS
  583. \fIindex2\fR inclusive.
  584. If \fIindex2\fR is omitted then it defaults to \fIindex1\fR.
  585. .VE
  586. Returns an empty string.
  587. .TP
  588. \fIpathName \fBdisable \fIindex\fR
  589. .VS
  590. Change the state of the entry given by \fIindex\fR to \fBdisabled\fR
  591. and redisplay the entry using its disabled colors.
  592. Returns an empty string.
  593. This command is obsolete and will eventually be removed;
  594. use ``\fIpathName \fBentryconfigure \fIindex\fR \-state disabled\fR'' instead.
  595. .VE
  596. .TP
  597. \fIpathName \fBenable \fIindex\fR
  598. .VS
  599. Change the state of the entry given by \fIindex\fR to \fBnormal\fR
  600. and redisplay the entry using its normal colors.
  601. Returns an empty string.
  602. This command is obsolete and will eventually be removed;
  603. use ``\fIpathName \fBentryconfigure \fIindex\fR \-state normal\fR'' instead.
  604. .VE
  605. .TP
  606. \fIpathName \fBentryconfigure \fIindex\fR \fR?\fIoptions\fR?
  607. This command is similar to the \fBconfigure\fR command, except that
  608. it applies to the options for an individual entry, whereas \fBconfigure\fR
  609. applies to the options for the menu as a whole.
  610. \fIOptions\fR may have any of the values accepted by the \fBadd\fR
  611. widget command.  If \fIoptions\fR are specified, options are modified
  612. as indicated
  613. in the command and the command returns an empty string.
  614. If no \fIoptions\fR are specified, returns a list describing
  615. the current options for entry \fIindex\fR (see \fBTk_ConfigureInfo\fR for
  616. information on the format of this list).
  617. .TP
  618. \fIpathName \fBindex \fIindex\fR
  619. Returns the numerical index corresponding to \fIindex\fR, or
  620. \fBnone\fR if \fIindex\fR was specified as \fBnone\fR.
  621. .TP
  622. \fIpathName \fBinvoke \fIindex\fR
  623. Invoke the action of the menu entry.  See the sections on the
  624. individual entries above for details on what happens.  If the
  625. menu entry is disabled then nothing happens.  If the
  626. entry has a command associated with it then the result of that
  627. command is returned as the result of the \fBinvoke\fR widget
  628. command.  Otherwise the result is an empty string.  Note:  invoking
  629. a menu entry does not automatically unpost the menu.  Normally
  630. the associated menubutton will take care of unposting the menu.
  631. .TP
  632. \fIpathName \fBpost \fIx y\fR
  633. Arrange for the menu to be displayed on the screen at the root-window
  634. coordinates given by \fIx\fR and \fIy\fR.  These coordinates are
  635. adjusted if necessary to guarantee that the entire menu is visible on
  636. the screen.  This command normally returns an empty string.
  637. .VS
  638. If the \fB\-postcommand\fR option has been specified, then its value is
  639. executed as a Tcl script before posting the menu and the result of
  640. that script is returned as the result of the \fBpost\fR widget
  641. command.
  642. If an error returns while executing the command, then the error is
  643. returned without posting the menu.
  644. .VE
  645. .TP
  646. \fIpathName \fBunpost\fR
  647. Unmap the window so that it is no longer displayed.  If a
  648. lower-level cascaded menu is posted, unpost that menu.  Returns an
  649. empty string.
  650. .TP
  651. \fIpathName \fByposition \fIindex\fR
  652. Returns a decimal string giving the y-coordinate within the menu
  653. window of the topmost pixel in the entry specified by \fIindex\fR.
  654.  
  655.  
  656. .SH "DEFAULT BINDINGS"
  657. .PP
  658. .VS
  659. Tk automatically creates class bindings for menus that give them
  660. the following default behavior:
  661. .IP [1]
  662. When the mouse cursor enters a menu, the entry underneath the mouse
  663. cursor is activated;  as the mouse moves around the menu, the active
  664. entry changes to track the mouse.
  665. .IP [2]
  666. When button 1 is released over a menu, the active entry (if any) is invoked.
  667. .IP [3]
  668. A menu can be repositioned on the screen by dragging it with mouse
  669. button 2.
  670. .IP [4]
  671. A number of other bindings are created to support keyboard menu traversal.
  672. See the manual entry for \fBtk_bindForTraversal\fR for details on these
  673. bindings.
  674. .PP
  675. Disabled menu entries are non-responsive:  they don't activate and
  676. ignore mouse button presses and releases.
  677. .PP
  678. The behavior of menus can be changed by defining new bindings for
  679. individual widgets or by redefining the class bindings.
  680. .VE
  681.  
  682. .SH BUGS
  683. .PP
  684. .VS
  685. At present it isn't possible to use the
  686. option database to specify values for the options to individual
  687. entries.
  688. .VE
  689.  
  690. .SH KEYWORDS
  691. menu, widget
  692.